package com.lingchou.cloud.process.client.controller;

import com.lc.common.bean.response.Result;
import com.lingchou.cloud.process.api.controller.ProcessDynamicApi;
import com.lingchou.cloud.process.api.dto.param.SummaryApproveParam;
import com.lingchou.cloud.process.client.service.DynamicAsyncService;
import io.swagger.annotations.Api;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/process/v1")
@Api(value = "ProcessDynamicApiImpl", tags = "流程动态操作API")
public class ProcessDynamicApiImpl implements ProcessDynamicApi {
    private final DynamicAsyncService dynamicAsyncService;

    public ProcessDynamicApiImpl(DynamicAsyncService dynamicAsyncService) {
        this.dynamicAsyncService = dynamicAsyncService;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Result<Object> summaryApprove(SummaryApproveParam summaryApproveParam) {
        long start = System.currentTimeMillis();
        dynamicAsyncService.summaryApprove(summaryApproveParam);
        System.err.println("summaryApprove:" + (System.currentTimeMillis() - start));
        return Result.success();
    }




}
